<?php

namespace App\Http\Controllers\Frontend;

use Laravel\Lumen\Routing\Controller as BaseController;

use App\Model\CarBrand;

class BrandController extends BaseController
{

    /**
     * show all brands
     */
    public function index(){

        $res = [
            'desc' => '查询成功！',
            'size' => '',
            'statusCode' => 1,
            'result' => []
        ];
        $brands = CarBrand::all();

        foreach ( $brands as $brand ) {
            $res['result'][] = [
                'c_oem_brand' => $brand->name,
                't_letter' => $brand->letter_pre,
            ];
        }
        $res['size'] = count( $res['result'] );
        echo json_encode( $res );

    }

}
